<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <input style="width:20px;height:17px !important;height:18px;border:1px solid #CCCCCC;"
           id="myinput"
           type="text"
           onkeydown="javascript:if(event.keyCode==13){var page=(this.value>3)?3:this.value; var destLocation='/BroPhpDemoCode/21/goods/index.php?action=list&amp;page='+page; console.log(destLocation);}"
           value="2">
    <!--<input style="cursor:pointer;width:25px;height:18px;border:1px solid #CCCCCC;" type="button" value="GO"-->
           <!--onclick="javascript:var page=(this.previousSibling.value>3)?3:this.previousSibling.value; var destLocation='/BroPhpDemoCode/21/goods/index.php?action=list&amp;page='+page; console.log(destLocation);">-->

    <input style="cursor:pointer;width:25px;height:18px;border:1px solid #CCCCCC;" type="button" value="GO" onclick="buttonClick(this)">

    <script>
        function buttonClick(button) {
            var inputText = document.getElementById("myinput")
            var page=(inputText.value>3) ? 3 : inputText.value;
            var destLocation='/BroPhpDemoCode/21/goods/index.php?action=list&amp;page='+page;
            console.log(destLocation);
        }
    </script>



<hr>
    <p>示例列表:</p>
    <ul id="myList"><li id="item1">Coffee</li><li id="item2">Tea</li></ul>
    <p id="demo">单击按钮得到某节点的前一节点的列表项</p>
    <button onclick="myFunction()">点我</button>
    <script>
        function myFunction(){
            var itm=document.getElementById("item2");
            var x=document.getElementById("demo");
            x.innerHTML=itm.previousSibling.id;
        }
    </script>
    <p><strong>注意:</strong> 空格是文本，文本是节点。</p>
    <p>尝试在&lt;li&gt;元素之间添加空格，结果将是"undefined"。</p>
</div>
</body>
</html>